<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>offset-path interpolation with allow-discrete</title>
    <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-path-property">
    <meta name="assert" content="offset-path supports animation with allow-discrete.">
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/css/support/interpolation-testcommon.js"></script>
  </head>
  <style>
    .parent {
      offset-path: circle(farthest-side);
    }
    .target {
      offset-path: circle(10px);
    }
  </style>
  <body>
    <script>
      'use strict';

      test_interpolation({
        property: 'offset-path',
        behavior: 'allow-discrete',
        from: 'circle(10px)',
        to: 'inset(20px)',
      }, [
        {at: -1, expect: 'circle(10px)'},
        {at: 0, expect: 'circle(10px)'},
        {at: 0.4, expect: 'circle(10px)'},
        {at: 0.5, expect: 'inset(20px)'},
        {at: 1, expect: 'inset(20px)'},
        {at: 1.5, expect: 'inset(20px)'},
      ]);

      test_interpolation({
        property: 'offset-path',
        behavior: 'allow-discrete',
        from: 'ellipse(at center)',
        to: 'none',
      }, [
        {at: -1, expect: 'ellipse(at center)'},
        {at: 0, expect: 'ellipse(at center)'},
        {at: 0.4, expect: 'ellipse(at center)'},
        {at: 0.5, expect: 'none'},
        {at: 1, expect: 'none'},
        {at: 1.5, expect: 'none'},
      ]);

      test_interpolation({
        property: 'offset-path',
        behavior: 'allow-discrete',
        from: neutralKeyframe,
        to: 'none',
      }, [
        {at: -1, expect: 'circle(10px)'},
        {at: 0, expect: 'circle(10px)'},
        {at: 0.4, expect: 'circle(10px)'},
        {at: 0.5, expect: 'none'},
        {at: 1, expect: 'none'},
        {at: 1.5, expect: 'none'},
      ]);

      test_interpolation({
        property: 'offset-path',
        behavior: 'allow-discrete',
        from: 'initial',
        to: 'circle()',
      }, [
        {at: -1, expect: 'none'},
        {at: 0, expect: 'none'},
        {at: 0.4, expect: 'none'},
        {at: 0.5, expect: 'circle()'},
        {at: 1, expect: 'circle()'},
        {at: 1.5, expect: 'circle()'},
      ]);

      test_interpolation({
        property: 'offset-path',
        behavior: 'allow-discrete',
        from: 'inherit',
        to: 'circle()',
      }, [
        {at: -0.1, expect: 'circle(farthest-side)'},
        {at: 0, expect: 'circle(farthest-side)'},
        {at: 0.4, expect: 'circle(farthest-side)'},
        {at: 0.5, expect: 'circle()'},
        {at: 1, expect: 'circle()'},
        {at: 1.5, expect: 'circle()'},
      ]);

      test_interpolation({
        property: 'offset-path',
        behavior: 'allow-discrete',
        from: 'unset',
        to: 'inset(10%)',
      }, [
        {at: -0.1, expect: 'none'},
        {at: 0, expect: 'none'},
        {at: 0.4, expect: 'none'},
        {at: 0.5, expect: 'inset(10%)'},
        {at: 1, expect: 'inset(10%)'},
        {at: 1.5, expect: 'inset(10%)'},
      ]);

      test_interpolation({
        property: 'offset-path',
        behavior: 'allow-discrete',
        from: 'ray(0deg)',
        to: 'url("abc")',
      }, [
        {at: -0.1, expect: 'ray(0deg)'},
        {at: 0, expect: 'ray(0deg)'},
        {at: 0.4, expect: 'ray(0deg)'},
        {at: 0.5, expect: 'url("abc")'},
        {at: 1, expect: 'url("abc")'},
        {at: 1.5, expect: 'url("abc")'},
      ]);

    </script>
  </body>
</html>
